#ifndef __DRV_ST485_H
#define __DRV_ST485_H
#include "stm32f4xx.h"
#include "rtthread.h"

#define MOTOR_ID					0X01

#define REG_ACC						0X29
#define REG_TAR_POS_L			0X2A
#define REG_TAR_POS_H			0X2B
#define REG_TAR_SPEED_L		0X2E
#define REG_TAR_SPEED_H		0X2F

#define REG_CUR_POS_L			0X38
#define REG_CUR_POS_H			0X39
#define REG_CUR_SPEED_L		0X3A
#define REG_CUR_SPEED_H	  0X3B

#define SBUS_CH_BASE 1000
#define TARPOS_BASE  2100

#define ST_UART_SEND_QUEUE_SIZE 20
#define ST_UART_REC_QUEUE_SIZE 2

void SetSteeringMotorPositon(u8 acc,u16 speed ,u16 position);
void DmaSendDataProc(DMA_Stream_TypeDef *DMA_Streamx,u16 ndtr);
void STUartxDMASendData(u8* pSendInfo, u16 nSendCount);
void SteeringMotor485WriteCmd(u8 id,u8 reg ,u8 length ,u8* data);
void SteeringMotor485ReadCmd(u8 id,u8 reg ,u8 length );
void ReadSteeringMotorPositon(void);
u16 STMOTOR_RecHandler(u8* recbuff,u8 buff_length);

extern rt_mq_t  rt_mq_STmotor_send ;
extern rt_mq_t  rt_mq_STmotor_rec;

#endif

/*********************************************** END OF FILE DRV_ST485.H ***********************************************/